from lianxi.xiecheng.base import base
from selenium.webdriver.common.by import By
from selenium import webdriver

class card_page(base):
    card1 = (By.XPATH, '/html/body/div[5]/div[1]/ul/li[25]/a')#悬停
    card2 = (By.LINK_TEXT, '礼品卡首页')#点击礼品卡首页
    card3 = (By.LINK_TEXT, '充值')#点击充值
    card4 = (By.ID, 'customInput')#输入充值金额
    card5 = (By.CSS_SELECTOR, '#goBooking')#点击立即充值
    card6 = (By.XPATH, '/html/body/container/div[2]/div[2]/a')#点击我知道
    card7 = (By.XPATH, '/html/body/form/div/div/div[1]/div[14]/div[3]/div/div/a')#点击提交订单
    url = 'https://www.ctrip.com/'# 网址
    te1 = '500'# 金额


    def card(self):
        self.get_url(self.url)
        self.get_sleep()
        self.add_cookie()
        self.get_sx()
        self.get_sleep()
        self.get_move(*self.card1)
        self.get_sleep()
        self.get_click(*self.card2)
        self.get_sleep()
        self.get_click(*self.card3)
        self.get_sleep()
        self.get_jb(-1)
        self.get_text(self.te1,*self.card4)
        self.get_sleep()
        self.get_click(*self.card5)
        self.get_sleep()
        self.get_click(*self.card6)
        self.get_sleep()
        self.get_gun()
        self.get_sleep()
        self.get_click(*self.card7)
        self.get_sleep()